package com.db.gffxo.epi.test;


import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcDaoSupport;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import junit.framework.TestCase;
import com.db.gffxo.epi.domain.EventFormat;
import com.db.gffxo.epi.repository.EventFormatDaoGen;


public class EventFormatTestGen extends TestCase {

private DriverManagerDataSource dataSource;
private EventFormatDaoGen dao;
private EventFormat EventFormat;
	public void setUp() {
		dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName("com.mysql.jdbc.Driver");
		dataSource.setUrl("jdbc:mysql:///epi");
		dataSource.setUsername("epi");
		dataSource.setPassword("epiepi");
		dao= new EventFormatDaoGen();
		dao.setDataSource(dataSource);

		EventFormat = new EventFormat();
		EventFormat.setEventType("EventType");
		EventFormat.setFormatterName("FormatterName");
		EventFormat.setFormatterParams("FormatterParams");
	}

	public void testInsertAndGet () {

		dao.insert(EventFormat);

		List dbaEventFormats = dao.getEventFormat();

		EventFormat dbaEventFormat = (EventFormat) dbaEventFormats.get(0);

		assertEquals("EventType",EventFormat.getEventType(),dbaEventFormat.getEventType());
		assertEquals("FormatterName",EventFormat.getFormatterName(),dbaEventFormat.getFormatterName());
		assertEquals("FormatterParams",EventFormat.getFormatterParams(),dbaEventFormat.getFormatterParams());
	}

}